/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.isi.pegasus.planner.subworkflow.scheduler.implementation;

import edu.isi.pegasus.planner.classes.ADag;
import edu.isi.pegasus.planner.classes.PegasusBag;
import edu.isi.pegasus.planner.dax.ParADAG;
import edu.isi.pegasus.planner.subworkflow.partitioner.DAXAbstraction;
import edu.isi.pegasus.planner.subworkflow.partitioner.SiteAbstraction;
import edu.isi.pegasus.planner.subworkflow.scheduler.Scheduler;
import java.util.Iterator;

/**
 *
 * @author wchen
 */
public class Static extends Scheduler{
    public Static(ADag dag, PegasusBag bag)
    {
        super(dag,bag);
    }
    @Override
    public void siteSelector()
    {
        int siteIndex = 0;
        //String dax_dir = this.mBag.getPegasusProperties().getProperty("pegasus.subworkflow.argument.dir");
        for (Iterator it  = mDaxMap.keySet().iterator(); it.hasNext();)
        {
            DAXAbstraction bigDax = (DAXAbstraction)it.next();
            ParADAG daxItem = bigDax.adag;
            String daxName = daxItem.getName() + ".xml";
            //String dax_path = dax_dir  + "/" + daxName;
            //daxItem.writeToFile(dax_path);
            //addReplicaCatalog(daxName , dax_path);
            try
            {
                  //SiteCatalogEntry se = (SiteCatalogEntry)mSiteIndex.get(siteIndex);
                siteIndex = bigDax.site;
                  SiteAbstraction site = (SiteAbstraction)mSiteIndex.get(siteIndex);
                  String siteName = site.name;
                  addDAXJob2DAG(daxName, daxItem.getName() , siteName);
            }
            catch (Exception e)
            {
                System.out.println("no such site name\n");
            }

        }
    }
}
